inherited fmCheckPodrazd: TfmCheckPodrazd
  Left = 525
  Top = 145
  Width = 800
  Height = 788
  Caption = #1055#1088#1086#1074#1077#1088#1082#1072' '#1094#1077#1083#1086#1089#1090#1085#1086#1089#1090#1080' '#1088#1072#1089#1087#1088#1077#1076#1083#1077#1085#1080#1103' '#1087#1086' '#1087#1086#1076#1088#1072#1079#1076#1077#1083#1077#1085#1080#1103#1084
  Constraints.MinHeight = 788
  Constraints.MinWidth = 800
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  inherited sbBottom: TStatusBar
    Top = 734
    Width = 792
  end
  inherited Panel1: TPanel
    Width = 792
    Visible = False
    inherited BitBtn1: TBitBtn
      Left = 622
    end
    inherited BitBtn2: TBitBtn
      Left = 710
    end
  end
  object Panel2: TPanel [2]
    Left = 0
    Top = 45
    Width = 792
    Height = 300
    Align = alTop
    BevelOuter = bvNone
    TabOrder = 2
    object rgConditions: TcxRadioGroup
      Left = 32
      Top = 11
      Caption = #1055#1086#1082#1072#1079#1072#1090#1100
      Properties.Items = <
        item
          Caption = #1045#1089#1090#1100' '#1076#1086#1087'. '#1089#1086#1075#1083#1072#1096'., '#1085#1086' '#1085#1077' '#1088#1072#1089#1087#1088#1077#1076#1077#1083#1077#1085' '
          Value = 0
        end
        item
          Caption = #1053#1077#1090' '#1076#1086#1087'. '#1089#1086#1075#1083#1072#1096'., '#1085#1086' '#1088#1072#1089#1087#1088#1077#1076#1077#1083#1077#1085
          Value = 1
        end
        item
          Caption = #1044#1091#1073#1083#1080#1088#1086#1074#1072#1085#1080#1077
          Value = 2
        end>
      Properties.OnChange = rgConditionsPropertiesChange
      ItemIndex = 0
      Style.LookAndFeel.SkinName = 'Office2007Black'
      StyleDisabled.LookAndFeel.SkinName = 'Office2007Black'
      StyleFocused.LookAndFeel.SkinName = 'Office2007Black'
      StyleHot.LookAndFeel.SkinName = 'Office2007Black'
      TabOrder = 1
      Height = 182
      Width = 353
    end
    object rgPodr: TcxRadioGroup
      Left = 408
      Top = 12
      Caption = #1055#1086#1076#1088#1072#1079#1076#1077#1083#1077#1085#1080#1077
      Properties.Columns = 2
      Properties.Items = <
        item
          Caption = #1054#1089#1085#1086#1074#1085#1086#1077
          Value = 0
        end
        item
          Caption = #1044#1086#1087#1086#1083#1085#1080#1090#1077#1083#1100#1085#1086#1077
          Value = 1
        end>
      Properties.OnChange = rgPodrPropertiesChange
      ItemIndex = 0
      Style.LookAndFeel.SkinName = 'Office2007Black'
      StyleDisabled.LookAndFeel.SkinName = 'Office2007Black'
      StyleFocused.LookAndFeel.SkinName = 'Office2007Black'
      StyleHot.LookAndFeel.SkinName = 'Office2007Black'
      TabOrder = 0
      Height = 49
      Width = 353
    end
    object bePodrazd: TcxButtonEdit
      Left = 32
      Top = 224
      ParentFont = False
      Properties.Buttons = <
        item
          Default = True
          Kind = bkEllipsis
        end>
      Properties.OnButtonClick = bePodrazdPropertiesButtonClick
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -13
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = []
      Style.LookAndFeel.SkinName = 'Office2007Black'
      Style.IsFontAssigned = True
      StyleDisabled.LookAndFeel.SkinName = 'Office2007Black'
      StyleFocused.LookAndFeel.SkinName = 'Office2007Black'
      StyleHot.LookAndFeel.SkinName = 'Office2007Black'
      TabOrder = 2
      Width = 593
    end
    object cxLabel1: TcxLabel
      Left = 32
      Top = 200
      Caption = #1060#1080#1083#1100#1090#1088' '#1087#1086#1076#1088#1072#1079#1076#1077#1083#1077#1085#1080#1081
    end
    object bShow: TcxButton
      Left = 640
      Top = 213
      Width = 137
      Height = 84
      Caption = #1055#1086#1082#1072#1079#1072#1090#1100' '#1088#1077#1079#1091#1083#1100#1090#1072#1090
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -13
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      TabOrder = 4
      OnClick = bShowClick
      LookAndFeel.SkinName = 'Office2007Black'
    end
    object cxLabel2: TcxLabel
      Left = 32
      Top = 248
      Caption = #1060#1080#1083#1100#1090#1088' '#1091#1089#1083#1091#1075
    end
    object beService: TcxButtonEdit
      Left = 32
      Top = 272
      ParentFont = False
      Properties.Buttons = <
        item
          Default = True
          Kind = bkEllipsis
        end>
      Properties.OnButtonClick = cxButtonEdit1PropertiesButtonClick
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -13
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = []
      Style.LookAndFeel.SkinName = 'Office2007Black'
      Style.IsFontAssigned = True
      StyleDisabled.LookAndFeel.SkinName = 'Office2007Black'
      StyleFocused.LookAndFeel.SkinName = 'Office2007Black'
      StyleHot.LookAndFeel.SkinName = 'Office2007Black'
      TabOrder = 6
      Width = 593
    end
    object rgServeces: TcxRadioGroup
      Left = 408
      Top = 84
      Caption = #1059#1089#1083#1091#1075#1080
      Properties.Columns = 2
      Properties.Items = <
        item
          Caption = #1054#1089#1085#1086#1074#1085#1099#1077
          Value = 0
        end
        item
          Caption = #1044#1088#1091#1075#1080#1077
          Value = 1
        end>
      Properties.OnChange = rgServecesPropertiesChange
      ItemIndex = 0
      Style.LookAndFeel.SkinName = 'Office2007Black'
      StyleDisabled.LookAndFeel.SkinName = 'Office2007Black'
      StyleFocused.LookAndFeel.SkinName = 'Office2007Black'
      StyleHot.LookAndFeel.SkinName = 'Office2007Black'
      TabOrder = 7
      Height = 49
      Width = 353
    end
    object deDate: TcxDateEdit
      Left = 408
      Top = 168
      ParentFont = False
      Properties.OnChange = deDatePropertiesChange
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -15
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = []
      Style.LookAndFeel.SkinName = 'Office2007Black'
      Style.Shadow = False
      Style.IsFontAssigned = True
      StyleDisabled.LookAndFeel.SkinName = 'Office2007Black'
      StyleFocused.LookAndFeel.SkinName = 'Office2007Black'
      StyleHot.LookAndFeel.SkinName = 'Office2007Black'
      TabOrder = 8
      Width = 161
    end
    object cxLabel3: TcxLabel
      Left = 408
      Top = 144
      Caption = #1053#1072' '#1076#1072#1090#1091
    end
  end
  object dbgPodr: TcxGrid [3]
    Left = 0
    Top = 345
    Width = 792
    Height = 389
    Align = alClient
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
    TabOrder = 3
    LookAndFeel.Kind = lfStandard
    object tvPodr: TcxGridDBTableView
      NavigatorButtons.ConfirmDelete = False
      NavigatorButtons.First.Visible = True
      NavigatorButtons.PriorPage.Visible = True
      NavigatorButtons.Prior.Visible = True
      NavigatorButtons.Next.Visible = True
      NavigatorButtons.NextPage.Visible = True
      NavigatorButtons.Last.Visible = True
      NavigatorButtons.Insert.Visible = False
      NavigatorButtons.Append.Visible = False
      NavigatorButtons.Delete.Visible = False
      NavigatorButtons.Edit.Visible = False
      NavigatorButtons.Post.Visible = False
      NavigatorButtons.Cancel.Visible = False
      NavigatorButtons.Refresh.Visible = False
      NavigatorButtons.SaveBookmark.Visible = False
      NavigatorButtons.GotoBookmark.Enabled = False
      NavigatorButtons.GotoBookmark.Visible = False
      NavigatorButtons.Filter.Visible = False
      FilterBox.CustomizeDialog = False
      FilterBox.Visible = fvNever
      DataController.DataSource = dlgDS
      DataController.Summary.DefaultGroupSummaryItems = <>
      DataController.Summary.FooterSummaryItems = <
        item
          Kind = skCount
          FieldName = 'PLASTNAME'
          Column = tvPodrPLASTNAME
        end>
      DataController.Summary.SummaryGroups = <>
      DataController.Summary.Options = [soNullIgnore]
      OptionsBehavior.CellHints = True
      OptionsBehavior.FocusFirstCellOnNewRecord = True
      OptionsBehavior.IncSearch = True
      OptionsCustomize.ColumnFiltering = False
      OptionsCustomize.ColumnGrouping = False
      OptionsData.CancelOnExit = False
      OptionsData.Deleting = False
      OptionsData.DeletingConfirmation = False
      OptionsData.Editing = False
      OptionsData.Inserting = False
      OptionsView.NavigatorOffset = 5
      OptionsView.CellAutoHeight = True
      OptionsView.CellTextMaxLineCount = 1
      OptionsView.ColumnAutoWidth = True
      OptionsView.ExpandButtonsForEmptyDetails = False
      OptionsView.Footer = True
      OptionsView.GroupByBox = False
      OptionsView.HeaderEndEllipsis = True
      OptionsView.Indicator = True
      OptionsView.ShowColumnFilterButtons = sfbAlways
      Styles.Content = DMInv.cxData
      Styles.IncSearch = DMInv.cxGreenText
      Styles.Header = DMInv.cxSiniyText
      object tvPodrPLASTNAME: TcxGridDBColumn
        Caption = #1060#1072#1084#1080#1083#1080#1103
        DataBinding.FieldName = 'PLASTNAME'
        Width = 113
      end
      object tvPodrPNAME: TcxGridDBColumn
        Caption = #1048#1084#1103
        DataBinding.FieldName = 'PNAME'
        Width = 91
      end
      object tvPodrPPATRONYMIC: TcxGridDBColumn
        Caption = #1054#1090#1095#1077#1089#1090#1074#1086
        DataBinding.FieldName = 'PPATRONYMIC'
        Width = 115
      end
      object tvPodrPDATEBIRTH: TcxGridDBColumn
        Caption = #1044#1072#1090#1072' '#1088#1086#1078#1076'.'
        DataBinding.FieldName = 'PDATEBIRTH'
        Width = 89
      end
      object tvPodrPODR: TcxGridDBColumn
        Caption = #1054#1089#1085'. '#1087#1086#1076#1088#1072#1079#1076'.'
        DataBinding.FieldName = 'PODR'
        Width = 126
      end
      object tvPodrSDNAME: TcxGridDBColumn
        Caption = #1055#1086#1076#1088#1072#1079#1076
        DataBinding.FieldName = 'SDNAME'
        Width = 136
      end
    end
    object cxGridLevel2: TcxGridLevel
      GridView = tvPodr
    end
  end
  object cxMemo1: TcxMemo [4]
    Left = 56
    Top = 384
    Lines.Strings = (
      'cxMemo1')
    TabOrder = 4
    Visible = False
    Height = 281
    Width = 681
  end
  inherited dlgDS: TDataSource
    DataSet = qResult
    Left = 456
    Top = 128
  end
  object qResult: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      
        'SELECT P.PLASTNAME, P.PNAME, P.PPATRONYMIC, P.PDATEBIRTH, SD.SDN' +
        'AME sdname,'
      'Sd1.SDNAME AS podr'
      'FROM SPEC_COND SC'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC.AGID'
      'INNER JOIN SERVICES S ON S.SCID = SC.SCID '
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = S.STID'
      'INNER JOIN PEOPLE P ON P.PID = APU.PID'
      'INNER JOIN SYS_DIC SD ON SD.SDID = ST.SDID'
      'LEFT OUTER JOIN DETI_PODRAZD DP ON DP.PID = P.PID'
      'LEFT OUTER JOIN SYS_DIC SD1 ON SD1.SDID = DP.SDID'
      'WHERE SC.SCISDELETE IS NULL'
      
        ' AND CURRENT_DATE BETWEEN SC.SCDATEBEGIN AND COALESCE(SC.SCDATEE' +
        'ND, CURRENT_DATE)'
      
        ' AND :data BETWEEN cast(DP.DPDATEIN AS DATE) AND CAST(COALESCE(D' +
        'P.DPDATEOUT, CURRENT_TIMESTAMP) AS DATE)')
    Left = 488
    Top = 125
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'data'
        ParamType = ptUnknown
      end>
    object qResultPLASTNAME: TIBStringField
      FieldName = 'PLASTNAME'
      Origin = '"PEOPLE"."PLASTNAME"'
      Size = 255
    end
    object qResultPNAME: TIBStringField
      FieldName = 'PNAME'
      Origin = '"PEOPLE"."PNAME"'
      Size = 255
    end
    object qResultPPATRONYMIC: TIBStringField
      FieldName = 'PPATRONYMIC'
      Origin = '"PEOPLE"."PPATRONYMIC"'
      Size = 255
    end
    object qResultPDATEBIRTH: TDateField
      FieldName = 'PDATEBIRTH'
      Origin = '"PEOPLE"."PDATEBIRTH"'
    end
    object qResultSDNAME: TIBStringField
      FieldName = 'SDNAME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qResultPODR: TIBStringField
      FieldName = 'PODR'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
  end
  object qTmp: TIBQuery
    SQL.Strings = (
      
        'SELECT P.PLASTNAME, P.PNAME, P.PPATRONYMIC, P.PDATEBIRTH, SD.SDN' +
        'AME sdname,'
      'Sd1.SDNAME AS podr'
      'FROM SPEC_COND SC'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC.AGID'
      'INNER JOIN SERVICES S ON S.SCID = SC.SCID '
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = S.STID'
      'INNER JOIN PEOPLE P ON P.PID = APU.PID'
      'INNER JOIN SYS_DIC SD ON SD.SDID = ST.SDID'
      
        'LEFT OUTER JOIN DETI_PODRAZD DP1 ON DP1.PID = P.PID  AND :data B' +
        'ETWEEN cast(DP1.DPDATEIN AS DATE) AND CAST(COALESCE(DP1.DPDATEOU' +
        'T, CURRENT_TIMESTAMP) AS DATE)'
      'LEFT OUTER JOIN SYS_DIC SD1 ON SD1.SDID = DP1.SDID'
      'WHERE SC.SCISDELETE IS NULL'
      
        ' AND :data BETWEEN SC.SCDATEBEGIN AND COALESCE(SC.SCDATEEND, CUR' +
        'RENT_DATE)'
      '')
    Left = 528
    Top = 189
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'data'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'data'
        ParamType = ptUnknown
      end>
  end
  object qSd_osn: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT t1.*'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID)'
      '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID FROM SYS_DIC SD'
      '      WHERE sd.SDPARID in (11746, 1880)'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID'
      ''
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t '
      '           ON t.sdid = sd1.SDPARID)'
      ' SELECT  SDNAME, SDID, SDPARID FROM tree t'
      ') AS t1'
      'order by 1')
    Left = 584
    Top = 133
  end
  object qsd_other: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT t1.*'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID)'
      '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID FROM SYS_DIC SD'
      '      WHERE sd.SDPARID in (1881, 1882) AND SD.SDPARID <> 11746'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID'
      ''
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t '
      '           ON t.sdid = sd1.SDPARID)'
      ' SELECT  SDNAME, SDID, SDPARID FROM tree t'
      ') AS t1'
      'UNION'
      'SELECT SD.SDNAME, SD.SDID, SD.SDPARID'
      'FROM SYS_DIC SD'
      'WHERE SD.SDID IN (1881, 1882) AND SD.SDPARID <> 11746'
      'order by 1')
    Left = 616
    Top = 133
  end
  object qTmp2: TIBQuery
    SQL.Strings = (
      
        'select P.PLASTNAME, P.PNAME, P.PPATRONYMIC, P.PDATEBIRTH, sd.SDN' +
        'AME, sd.SDNAME AS podr'
      'from DETI_PODRAZD DP'
      'INNER JOIN PEOPLE P ON P.PID = DP.PID'
      'INNER JOIN SYS_DIC SD ON SD.SDID = dp.SDID'
      
        'where :data BETWEEN cast(DP.DPDATEIN as date) AND  cast(coalesce' +
        '(DP.DPDATEOUT, current_timestamp) as date)'
      'AND not exists(select SC.SCID'
      '                 from SPEC_COND SC'
      
        '                 inner join AGR_POLUCH_USLUG APU on APU.AGID = S' +
        'C.AGID'
      '                 inner join SERVICES S on S.SCID = SC.SCID'
      '                 inner join SERVICES_TYPE ST on ST.STID = S.STID'
      
        '                 INNER JOIN SERV_PODR_LINK SPL ON SPL.STID = ST.' +
        'STID'
      '                 where SC.SCISDELETE is null and'
      '                       APU.PID = DP.PID'
      '                       AND SPL.SDID = DP.SDID'
      
        '                       AND :data between SC.SCDATEBEGIN and coal' +
        'esce(SC.SCDATEEND, current_date)'
      '                       )')
    Left = 464
    Top = 229
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'data'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'data'
        ParamType = ptUnknown
      end>
  end
  object qTmp3: TIBQuery
    SQL.Strings = (
      
        'select P.PLASTNAME, P.PNAME, P.PPATRONYMIC, P.PDATEBIRTH, sd.SDN' +
        'AME, sd1.SDNAME AS podr'
      'from DETI_PODRAZD_MISC DP'
      'INNER JOIN PEOPLE P ON P.PID = DP.PID'
      'INNER JOIN SYS_DIC SD ON SD.SDID = dp.SDID'
      
        'LEFT OUTER JOIN DETI_PODRAZD DP1 ON DP1.PID = P.PID AND :data BE' +
        'TWEEN cast(DP1.DPDATEIN as date) AND  cast(coalesce(DP1.DPDATEOU' +
        'T, current_timestamp) as date)'
      'LEFT OUTER JOIN SYS_DIC SD1 ON SD1.SDID = DP1.SDID'
      
        'where :data BETWEEN cast(DP.DPDATEIN as date) AND  cast(coalesce' +
        '(DP.DPDATEOUT, current_timestamp) as date)'
      ''
      'AND not exists(select SC.SCID'
      '                 from SPEC_COND SC'
      
        '                 inner join AGR_POLUCH_USLUG APU on APU.AGID = S' +
        'C.AGID'
      '                 inner join SERVICES S on S.SCID = SC.SCID'
      '                 inner join SERVICES_TYPE ST on ST.STID = S.STID'
      
        '                 INNER JOIN SERV_PODR_LINK SPL ON SPL.STID = ST.' +
        'STID'
      '                 where SC.SCISDELETE is null and'
      '                       APU.PID = DP.PID'
      '                       AND SPL.SDID = DP.SDID'
      
        '                       AND :data between SC.SCDATEBEGIN and coal' +
        'esce(SC.SCDATEEND, current_date)'
      '                       )')
    Left = 496
    Top = 229
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'data'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'data'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'data'
        ParamType = ptUnknown
      end>
  end
  object qTmp4: TIBQuery
    SQL.Strings = (
      
        '    SELECT distinct P.PLASTNAME, P.PNAME, P.PPATRONYMIC, P.PDATE' +
        'BIRTH, sd.SDNAME, sd.SDNAME AS podr'
      '    FROM DETI_PODRAZD DP'
      '    INNER JOIN PEOPLE P ON P.PID = DP.PID'
      '    INNER JOIN SYS_DIC SD ON SD.SDID = DP.SDID'
      
        '    WHERE  :data  BETWEEN cast(DP.DPDATEIN AS DATE) AND CAST(COA' +
        'LESCE(DP.DPDATEOUT, CURRENT_TIMESTAMP) AS DATE)'
      '    AND EXISTS'
      '    ('
      '    SELECT DP1.DPID'
      '    FROM DETI_PODRAZD DP1'
      '    WHERE'
      '    DP1.SDID = DP.SDID'
      '    AND DP1.PID = DP.PID'
      
        '    AND cast(DP1.DPDATEIN AS DATE) <= CAST(COALESCE(DP.DPDATEOUT' +
        ', CURRENT_TIMESTAMP) AS DATE)'
      
        '    AND CAST(COALESCE(DP1.DPDATEOUT, CURRENT_TIMESTAMP) AS DATE)' +
        ' >= cast(DP.DPDATEIN AS DATE)'
      '    AND DP.DPID <> DP1.DPID'
      '    )'
      ''
      '')
    Left = 464
    Top = 269
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'data'
        ParamType = ptUnknown
      end>
  end
  object qTmp5: TIBQuery
    SQL.Strings = (
      
        '     SELECT distinct P.PLASTNAME, P.PNAME, P.PPATRONYMIC, P.PDAT' +
        'EBIRTH, sd.SDNAME, sd1.SDNAME AS podr'
      '    FROM DETI_PODRAZD_MISC DP'
      '    INNER JOIN PEOPLE P ON P.PID = DP.PID'
      '    INNER JOIN SYS_DIC SD ON SD.SDID = DP.SDID'
      
        '    LEFT OUTER JOIN DETI_PODRAZD DP1 ON DP1.PID = DP.PID AND :da' +
        'ta BETWEEN cast(DP.DPDATEIN AS DATE) AND CAST(COALESCE(DP.DPDATE' +
        'OUT, CURRENT_TIMESTAMP) AS DATE)'
      'LEFT OUTER JOIN SYS_DIC SD1 ON SD1.SDID = DP1.SDID'
      
        '    WHERE  :data BETWEEN cast(DP.DPDATEIN AS DATE) AND CAST(COAL' +
        'ESCE(DP.DPDATEOUT, CURRENT_TIMESTAMP) AS DATE)'
      ''
      '    AND EXISTS'
      '    ('
      '    SELECT DP1.DPID'
      '    FROM DETI_PODRAZD_MISC DP1'
      '    WHERE'
      '    DP1.SDID = DP.SDID'
      '    AND DP1.PID = DP.PID'
      
        '    AND cast(DP1.DPDATEIN AS DATE) <= CAST(COALESCE(DP.DPDATEOUT' +
        ', CURRENT_TIMESTAMP) AS DATE)'
      
        '    AND CAST(COALESCE(DP1.DPDATEOUT, CURRENT_TIMESTAMP) AS DATE)' +
        ' >= cast(DP.DPDATEIN AS DATE)'
      '    AND DP.DPID <> DP1.DPID'
      '    )')
    Left = 504
    Top = 269
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'data'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'data'
        ParamType = ptUnknown
      end>
  end
end
